﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TWAFARBEN
    {

        public TWAFARBEN()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VWAFARBEN();
            this.DataContext = MV;
            InitializeComponent();
        }
     
        public override void LOADBYAUF()
        {
            base.LOADBYAUF();
            if (!IsAuto)
                return;
            if (TBMain.Rows.Count > 0)
                return;
            if (ORDERNUM.Length < 32)
                return;
            PM["ART"] = ORDERNUM.Substring(1, 20);
            PM["VAR"] = ORDERNUM.Substring(21, 2);
            PM["DES"] = ORDERNUM.Substring(24, 10);
            PM["FARBE"] = ORDERNUM.Substring(24, 10);
            PM["FINISH"] = FINISH.PadRight(10);
            PM["DESS"] = DESS.PadRight(10);
            PM["COLORIT"] = COLORIT.PadRight(10);
            if(IsYD)
            {
                PM["ZUART"] = "C";
            }
           else
            {
                PM["ZUART"] = "F";
            }
            TMV.NEWWA(PM);
            vwMaster.View.MoveCurrentToFirst();
        }
    }
}
